header

<clocale> (locale.h)

C localization library
The C language supports localization specific settings, such as culture-specific date formats or country-specific currency symbols.

Each system and specific compiler implementation may provide different choices of locales to be selected (using function setlocale), but at least two locales are available to choose for any C program:
  • The "C" locale is the minimal locale. It is a rather neutral locale which has the same settings across all systems and compilers, and therefore the exact results of a program using this locale are predictable. This is the locale used by default on all C programs.
  • The system's default locale (which is specified by an empty C-string: ""). It is the locale configuration provided by the environment where the application is running. This usually contains more localization information than the "C" locale.

This header declares the struct lconv and the functions setlocale and localeconv, along with several macros to be used with them. These are used to define locale-specific information.

Notice that locale configuration affects the behavior of many functions within the standard C library:
  • In <cstring> (<string.h>), functions strcoll and strxfrm are affected by character transformation rules.
  • In <cctype> (<ctype.h>), all functions except isdigit and isxdigit are affected by the extended character set selected.
  • In <cstdio> (<stdio.h>), formatted input/output operations are affected by character transformation rules and decimal-point character set in the numeric formatting settings.
  • In <ctime> (<time.h>), the function strftime is affected by the time formatting settings.
  • In this header, it affects the value returned by its functions setlocale and localeconv.

Some locale information is also provided to programs to better render its output in a locale-sensitive manner (localeconv).


Functions